﻿
@model IEnumerable<Models.View_CommentAU>
@{
    ViewBag.Title = "GetView_CommentAU";
    Layout = "~/Areas/HouTaiArea/Views/Shared/_Layout.cshtml";
}
@*@using (Html.BeginForm(FormMethod.Get))
    {*@
@section head{
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta name="description" content="Crush it Able The most popular Admin Dashboard template and ui kit">
        <meta name="author" content="PuffinTheme the theme designer">

        <link rel="icon" href="~/Crushit/light/favicon.ico" type="image/x-icon" />

        <title>:: Crush it :: Table Normal</title>

        <!-- Bootstrap Core and vandor -->
        @*<link rel="stylesheet" href="http://cdn.bootstrapmb.com/bootstrap/4.3.1/css/bootstrap.min.css" />*@

        <!-- Core css -->
        <link rel="stylesheet" href="/Crushit/assets/css/main.css" />
        <link rel="stylesheet" href="/Crushit/assets/css/theme4.css" id="stylesheet" />
        <style>
            #table {
                margin-left: 40%;
                height: 250px;
                font-size: 18px;
                width: 50%;
            }
        </style>
    </head>
    <div class="card-body">
        <div class="table-responsive">
            <table id="table">
                <thead>
                    <tr>
                        <th>编号</th>
                        <th _msthash="5072223" _msttexthash="4389879">文章</th>
                        <th _msthash="5072353" _msttexthash="2092545">评论人</th>
                        <th _msthash="5072483" _msttexthash="7861633">评论时间</th>
                        <th _msthash="5072483" _msttexthash="7861633">评论内容</th>
                        <th _msthash="5072483" _msttexthash="7861633">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            @*<td>@item.aid</td>*@
                            <th scope="row" _msthash="5079971" _msttexthash="4459">@item.aid</th>
                            @*<td>@item.title</td>*@
                            <td _msthash="5079686" _msttexthash="5761756">@item.title</td>
                            @*<td>@item.nname</td>*@
                            <td _msthash="5079816" _msttexthash="4700839">@item.nname</td>
                            @*<td>@item.cmtime</td>*@
                            <td _msthash="5079816" _msttexthash="4700839">@item.cmtime</td>
                            @*<td>@item.cmhtml</td>*@
                            <td _msthash="5079816" _msttexthash="4700839">@item.cmhtml</td>
                            @*<td>修改 删除</td>*@
                            <td _msthash="5079816" _msttexthash="4700839">修改 删除</td>
                        </tr>
                    }

                </tbody>
            </table>
        </div>
    </div>
    <script src="/Crushit/assets/bundles/lib.vendor.bundle.js"></script>
    <script src="/Crushit/assets/js/core.js"></script>
    @*}*@

    <script>
        @*$(function () {
            $.ajax({
                url: "@Url.Action("GetView_CommentAU")",
                datatype: 'json',
                type: "get",
                data: { /*pageindex: 1, pagesize:5*/},
                success: function (data) {
                    dataShow(data.d.Data);
                    alert(data.d.Data);
                    $('#example').bootstrapPaginator(Getoptions(JSON.parse(data)));
                    //BootstrapPaginator($('#example'),Getoptions(JSON.parse(data)));
                },
                error: function () { }
            });
            var myModal = new bootstrap.Modal(document.getElementById('staticBackdrop'));
            console.log(myModal);
            $("#sel").click(function () {
                $.post("@Url.Action("GetView_CommentAU")",
                    {
                        //pageindex: 1,
                        //pagesize: 5,
                        "aid": $("#aid").val(),
                    }, function (data) {
                    dataShow(data);
                    $('#example').bootstrapPaginator(Getoptions(JSON.parse(data)));
                });
            });
            $("#add").click(function () {
                //可以不用定义全局
                //var myModalEl = document.getElementById('staticBackdrop')
                //var modal = bootstrap.Modal.getInstance(myModalEl)
                //console.log(modal);
                //modal.hide();
                //myModal.hide()
                console.log(myModal);
                myModal.toggle();

            });
        })
        //表格显示数据
        function dataShow(r) {
            $(".table tr:gt(0)").remove();
            if (r != null) {
                $.each(eval("(" + r + ")").list, function (index, item) { //遍历返回的json
                    var tr = $("<tr>").appendTo(".table");
                    $("<td>").text(item.aid).appendTo(tr);
                    $("<td>").text(item.cid).appendTo(tr);
                    $("<td>").text(item.title).appendTo(tr);
                    $("<td>").text(item.author).appendTo(tr);
                    $("<td>").text(item.uid).appendTo(tr);
                    $("<td>").text(item.ctime).appendTo(tr);
                    //$("<td>").appendTo(tr).text(item.ptime);
                    //if (item.state == 1) {
                    //    $("<td>").appendTo(tr).text("草稿");
                    //} else if (item.MZ == 2) {
                    //    $("<td>").appendTo(tr).text("发布");
                    //}
                    //$("<td>").appendTo(tr).text(item.hits);
                    //$("<td>").appendTo(tr).text(item.comments);
                    //$("<td>").appendTo(tr).text(item.ahtml);
                });
            }
        }
        //显示分页插件的数据
        function Getoptions(r) {
            return {
                currentPage: r.currentPage, //当前页数
                totalPages: r.pageSum, //总页数
                itemTexts: function (type, page, current) {
                    switch (type) {
                        case "first":
                            return "首页";
                        case "prev":
                            return "上一页";
                        case "next":
                            return "下一页";
                        case "last":
                            return "末页";
                        case "page":
                            return page;
                    }
                },//点击事件，用于通过Ajax来刷新整个list列表
                onPageClicked: function (event, originalEvent, type, page) {
                    $.post("@Url.Action("GetView_CommentAU")",
                        {
                            pageindex: page,
                            pagesize: 5,
                            "aid": $("#aid").val(),
                            //"sex": $("input[name='sex']:checked").val()
                        }, function (r) {
                        dataShow(r);
                    });
                }
            }
        }*@
    </script>

    <script>
        //window.onload = function () {
        //    $.get("Index/GetView_CommentAU", function (data) {
        //        alert(data);
        //    })
        //}

    </script>
    <h2>GetView_CommentAU</h2>
}




